load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "geomfn",
    srcs = [
        "add_measure.go",
        "affine_transforms.go",
        "angle.go",
        "azimuth.go",
        "binary_predicates.go",
        "buffer.go",
        "collections.go",
        "coord.go",
        "de9im.go",
        "distance.go",
        "envelope.go",
        "flip_coordinates.go",
        "force_layout.go",
        "generate_points.go",
        "geomfn.go",
        "line_crossing_direction.go",
        "linear_reference.go",
        "linestring.go",
        "make_geometry.go",
        "mvtgeom.go",
        "node.go",
        "orientation.go",
        "point_polygon_optimization.go",
        "remove_repeated_points.go",
        "reverse.go",
        "segmentize.go",
        "shift_longitude.go",
        "simplify.go",
        "snap.go",
        "snap_to_grid.go",
        "subdivide.go",
        "swap_ordinates.go",
        "tile_envelope.go",
        "topology_operations.go",
        "unary_operators.go",
        "unary_predicates.go",
        "validity_check.go",
        "voronoi.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/geo/geomfn",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/geo",
        "//pkg/geo/geodist",
        "//pkg/geo/geographiclib",
        "//pkg/geo/geopb",
        "//pkg/geo/geos",
        "//pkg/geo/geosegmentize",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/util",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_twpayne_go_geom//:go-geom",
        "@com_github_twpayne_go_geom//encoding/ewkb",
        "@com_github_twpayne_go_geom//xy",
        "@com_github_twpayne_go_geom//xy/lineintersector",
    ],
)

go_test(
    name = "geomfn_test",
    size = "small",
    srcs = [
        "add_measure_test.go",
        "affine_transforms_test.go",
        "angle_test.go",
        "azimuth_test.go",
        "binary_predicates_bench_test.go",
        "binary_predicates_test.go",
        "buffer_test.go",
        "collections_test.go",
        "de9im_test.go",
        "distance_test.go",
        "envelope_test.go",
        "flip_coordinates_test.go",
        "force_layout_test.go",
        "generate_points_test.go",
        "geomfn_test.go",
        "line_crossing_direction_test.go",
        "linear_reference_test.go",
        "linestring_test.go",
        "make_geometry_test.go",
        "mvtgeom_test.go",
        "node_test.go",
        "orientation_test.go",
        "remove_repeated_points_test.go",
        "reverse_test.go",
        "segmentize_test.go",
        "shift_longitude_test.go",
        "simplify_test.go",
        "snap_test.go",
        "snap_to_grid_test.go",
        "subdivide_test.go",
        "swap_ordinates_test.go",
        "tile_envelope_test.go",
        "topology_operations_test.go",
        "unary_operators_test.go",
        "unary_predicates_test.go",
        "validity_check_test.go",
        "voronoi_test.go",
    ],
    data = ["//c-deps:libgeos"],
    embed = [":geomfn"],
    deps = [
        "//pkg/geo",
        "//pkg/geo/geopb",
        "//pkg/geo/geos",
        "//pkg/geo/geotest",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@com_github_twpayne_go_geom//:go-geom",
        "@com_github_twpayne_go_geom//encoding/wkt",
    ],
)
